#字符串代码案例测试练习
# 翻转字符串顺序
def reverse_world(s):
    tokens = s.split(" ")
    tokens.reverse()
    return " ".join(tokens)

# print(reverse_world("i am a student."))

# 判断字符串旋转是否正确
def rotate_string(s,goal):
    if len(goal) != len(s):
        return False
    return goal in (s + s)

# print(rotate_string("abcde","bcdea"))

# 统计给定字符串前缀的数目
def count_prefixes(worlds,s):
    count = 0
    for world in worlds:
        if world.startswith(world):
            count += 1
    return count
